home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / MSG.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  81 lines

  1. #ifndef _LINUX_MSG_H
  2. #define _LINUX_MSG_H
  3.  
  4. #include <linux/ipc.h>
  5.  
  6. /* ipcs ctl commands */
  7. #define MSG_STAT 11
  8. #define MSG_INFO 12
  9.  
  10. /* msgrcv options */
  11. #define MSG_NOERROR     010000  /* no error if message is too big */
  12. #define MSG_EXCEPT      020000  /* recv any msg except of specified type.*/
  13.  
  14. /* one msqid structure for each queue on the system */
  15. struct msqid_ds {
  16.     struct ipc_perm msg_perm;
  17.     struct msg *msg_first;        /* first message on queue */
  18.     struct msg *msg_last;        /* last message in queue */
  19.     __kernel_time_t msg_stime;    /* last msgsnd time */
  20.     __kernel_time_t msg_rtime;    /* last msgrcv time */
  21.     __kernel_time_t msg_ctime;    /* last change time */
  22.     struct wait_queue *wwait;
  23.     struct wait_queue *rwait;
  24.     unsigned short msg_cbytes;    /* current number of bytes on queue */
  25.     unsigned short msg_qnum;    /* number of messages in queue */
  26.     unsigned short msg_qbytes;    /* max number of bytes on queue */
  27.     __kernel_ipc_pid_t msg_lspid;    /* pid of last msgsnd */
  28.     __kernel_ipc_pid_t msg_lrpid;    /* last receive pid */
  29. };
  30.  
  31. /* message buffer for msgsnd and msgrcv calls */
  32. struct msgbuf {
  33.     long mtype;         /* type of message */
  34.     char mtext[1];      /* message text */
  35. };
  36.  
  37. /* buffer for msgctl calls IPC_INFO, MSG_INFO */
  38. struct msginfo {
  39.     int msgpool;
  40.     int msgmap; 
  41.     int msgmax; 
  42.     int msgmnb; 
  43.     int msgmni; 
  44.     int msgssz; 
  45.     int msgtql; 
  46.     unsigned short  msgseg; 
  47. };
  48.  
  49. #define MSGMNI   128   /* <= 1K */     /* max # of msg queue identifiers */
  50. #define MSGMAX  4056   /* <= 4056 */   /* max size of message (bytes) */
  51. #define MSGMNB 16384   /* ? */        /* default max size of a message queue */
  52.  
  53. /* unused */
  54. #define MSGPOOL (MSGMNI*MSGMNB/1024)  /* size in kilobytes of message pool */
  55. #define MSGTQL  MSGMNB            /* number of system message headers */
  56. #define MSGMAP  MSGMNB            /* number of entries in message map */
  57. #define MSGSSZ  16                /* message segment size */
  58. #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) /* max no. of segments */
  59. #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
  60.  
  61. #ifdef __KERNEL__
  62.  
  63. /* one msg structure for each message */
  64. struct msg {
  65.     struct msg *msg_next;   /* next message on queue */
  66.     long  msg_type;          
  67.     char *msg_spot;         /* message text address */
  68.     time_t msg_stime;       /* msgsnd time */
  69.     short msg_ts;           /* message text size */
  70. };
  71.  
  72. asmlinkage int sys_msgget (key_t key, int msgflg);
  73. asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
  74. asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp,
  75.                int msgflg);
  76. asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf);
  77.  
  78. #endif /* __KERNEL__ */
  79.  
  80. #endif /* _LINUX_MSG_H */
  81.